package by.msokoloff.javaweb2015.datamodel;

import java.util.Date;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.EnumType;
import javax.persistence.Enumerated;
import javax.persistence.Table;

import by.msokoloff.javaweb2015.datamodel.enums.AdmUserRole;
import by.msokoloff.javaweb2015.datamodel.enums.AdmUserStatus;

@Entity
@Table(name = "adm_user")
public class AdmUser extends AbstractEntity {

	@Column(unique = true, nullable = false, updatable = false)
	private String login;

	@Column(nullable = false)
	private String password;

	@Column
	private String name;

	@Column
	private String email;

	@Column(nullable = false, updatable = false)
	private Date creationDate;

	@Column
	private Date lastLoginDate;

	@Column(nullable = false)
	@Enumerated(EnumType.STRING)
	private AdmUserStatus status;

	@Column(nullable = false)
	@Enumerated(EnumType.STRING)
	private AdmUserRole role;

	public String getLogin() {
		return login;
	}

	public void setLogin(String login) {
		this.login = login;
	}

	public String getPassword() {
		return password;
	}

	public void setPassword(String password) {
		this.password = password;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public String getEmail() {
		return email;
	}

	public void setEmail(String email) {
		this.email = email;
	}

	public Date getCreationDate() {
		return creationDate;
	}

	public void setCreationDate(Date creationDate) {
		this.creationDate = creationDate;
	}

	public Date getLastLoginDate() {
		return lastLoginDate;
	}

	public void setLastLoginDate(Date lastLoginDate) {
		this.lastLoginDate = lastLoginDate;
	}

	public AdmUserStatus getStatus() {
		return status;
	}

	public void setStatus(AdmUserStatus status) {
		this.status = status;
	}

	public AdmUserRole getRole() {
		return role;
	}

	public void setRole(AdmUserRole role) {
		this.role = role;
	}

	@Override
	public String toString() {
		return "[User: " + this.login + "; Role: " + this.role + "]";
	}

}
